package com.bachongLightNovel.works.mapper;

import com.bachongLightNovel.model.dto.audit.AuditNovelDto;
import com.bachongLightNovel.model.dto.works.BrowseDto;
import com.bachongLightNovel.model.pojo.works.Novel;
import com.bachongLightNovel.model.vo.audit.AuditNovelVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Set;

/**
 * @author vermouth
 */
@Mapper
public interface WorksNovelMapper {
    void insert(Novel novel);

    List<Novel> selectByUserId(Long userId);

    Novel selectById(Long id);

    //根据id删除小说信息
    void deleteById(Long id);

    //根据id修改小说信息
    void update(Novel novel);

    //根据userId查询已经提交过的数据
    List<Novel> selectRecord(Long id);

    //根据发布状态查询数据
    List<AuditNovelVo> selectByStatus(short status);

    //修改发布状态，cas的方式
    int updateStatusOptim(AuditNovelDto dto);

    //根据小说名，模糊查询小说id
    List<Long> selectByNovelName(String novelName);

    //查询相应状态的记录总数
    Long countByStatus(short status);

    //分页条件查询审核通过的小说列表
    List<Novel> selectPass(Integer current, Integer size, BrowseDto dto);

    //根据id集合，查询相应数据
    List<Novel> selectByIds(Set<String> collectSet);
}
